//时间戳转时间格式
function timeToDate(date, flag = false) {
	var date = new Date(date * 1000) //如果date为13位不需要乘1000
	var Y = date.getFullYear() + '-'
	var M =
		(date.getMonth() + 1 < 10 ?
			'0' + (date.getMonth() + 1) :
			date.getMonth() + 1) + '-'
	var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
	var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
	var m =
		(date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
	var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
	if (flag) {
		return Y + M + D
	} else {
		return Y + M + D + h + m + s
	}
}

function noNull(value) {
	if (value !== undefined && value !== null && value !== '') {
		return value
	} else {
		return '-'
	}
}

function noImpty(value) {
	if (value === undefined && value === null && value === '') {
		return true;
	}
	if (typeof value == "string") {
		return value.trim().length == 0;
	}
	if (typeof value == "object") {
		return Object.keys(value).length == 0;
	}
	if (Array.isArray(value)) {
		return value.length == 0;
	}
	return false;
}
export default {
	timeToDate,
	noNull,
	noImpty,
}